package com.ycb;


import com.ycb.entity.Order;
import com.ycb.mapper.OrderMapper;
import com.ycb.utils.MybatisUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSession;

@Slf4j
public class Application {

    public static void main(String[] args) throws Exception {
        OrderMapper orderMapper = MybatisUtil.getOrderMapper();
        orderMapper.listJoinTableLimit();
        for (int i = 0; i < 3; i++) {
            Order o = new Order();
            o.setName("sharding");
            o.setAmt(10);
            MybatisUtil.getOrderMapper().insert(o);
        }
    }

    public static void testXA() throws Exception {
        SqlSession sqlSession = MybatisUtil.getSqlSession(false);
        OrderMapper orderMapper =  sqlSession.getMapper(OrderMapper.class);
        for (int i = 0; i < 3; i++) {
            Order o = new Order();
            o.setId(1001L);
            o.setName("sharding");
            o.setAmt(10);
            orderMapper.insert(o);
        }
        sqlSession.commit();
    }

}